<?php
class Model_DbTable_ProductColor extends Apps_Db_Table_Abstract {
	protected $_name = 'product_color';

	const STATUS_ACTIVE   = 1;
	const STATUS_INACTIVE = 0;
	const STATUS_DELETED  = -1;

	const SHOW_HOME       = 1;
	const NOT_SHOW_HOME   = 0;


	//LIST
// 	public function getList () {
// 		$q = $this->_db
// 				  ->select()
// 				  ->from($this->_name, null)
// 				  ->where('status =?', self::STATUS_ACTIVE)
// 				  ->order($this->_name . '.title')
// 				  ->columns(array('id'			    => 'id',
// 				 				  'title'		    => 'title',
// 				 				  'sorting_number'	=> 'sorting_number',
// 				  				  'created_date'    => 'created_date'));
//  		return $q;
// 	}

	public function listByProductColorJson($productColorJson) {
	    $colorArray = Zend_Json::decode($productColorJson);

	    $color = array();
	    if($colorArray) {
	        foreach($colorArray as $colorId) {
        	    $r = $this->_db
                    	    ->select()
                    	    ->from($this->_name, null)
                    	    ->where('status =?', self::STATUS_ACTIVE)
                    	    ->where('id =?', $colorId)
                    	    ->columns(array('title' => 'title'))
                    	    ->query()
                    	    ->fetch();
                if($r) {
            	    array_push($color, $r['title']);
                }
	        }
	    }

	    return $color;
	}

}